/*
 * Copyright 2015-2019 Evun Technology. 
 * 
 * This software is the confidential and proprietary information of
 * Evun Technology. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with evun.cn.
 */
package cn.evun.sweet.demo.extend;

import java.util.Map;

import cn.evun.sweet.core.log.CustomPropertiesRewritePolicy;
import cn.evun.sweet.core.log.LogFilter;
import cn.evun.sweet.core.log.LogFilterChain;

/**
 * 重新日志的敏感数据的示范
 *
 * @author yangw
 * @since 1.0.0
 */
public class AccountLogRewriteFilter implements LogFilter {

	/* (non-Javadoc)
	 * @see cn.evun.sweet.core.log.LogFilter#doFilter(org.apache.logging.log4j.core.LogEvent, cn.evun.sweet.core.log.LogFilterChain)
	 */
	@Override
	public void doFilter(Map<String, String> map, LogFilterChain chain) {
		String newlog = map.get(CustomPropertiesRewritePolicy.REWRITE_OBJKEY_MESSAGE);
		map.put(CustomPropertiesRewritePolicy.REWRITE_OBJKEY_MESSAGE, newlog.replace("62226 7687 1376 6777", "***** **** **** 6777"));
		chain.doFilter(map, chain);
	}

}
